class Myarray{
    public <T extends Comparable>T findMaxVal(T[] array) {
        T max = array[0];
        for (int i = 1; i < array.length; i++) {
            if(array[i].compareTo(max) > 0) {
                max = array[i];
            }
        }
        return max;
    }
}
public class Test {
    public static void main(String[] args) {
        Integer[] array={1,2,5,8,100,20};
        Myarray myarray=new Myarray();
        System.out.println(myarray.findMaxVal(array));
    }
}